<?php @session_start();?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title>
    <?php
    $categorias= array('Ciencias','Lenguas','Matematicas','Historia', 'Fisica', 'IAW','Quimica','FDH');
    $length = count($categorias);
    $sizemenu=100/$length;
    ?>
   
    <style>

        body {
            margin: 0;
            font-family: Arial;
            font-size: x-large;
        }

        img {
            position:relative;
            top: 1px;
            left: -19px;
            height: 163px;
            width: 461px;
            text-decoration: none;
        }

        #cabecera {
            /*background-color: #9453ae;*/
            width: 100%;
            height: 150px;
            background: -webkit-linear-gradient(orange, pink);
            background: -ms-linear-gradient(orange, pink);
            background: -moz-linear-gradient(orange, pink);
            background: -o-linear-gradient(orange, pink);
        }

        #menu {
            /*background-color: #ba88ce;*/
            width: 100%;
            height: 70px;
            background: -webkit-linear-gradient(pink, white);
            background: -ms-linear-gradient(pink, white);
            background: -moz-linear-gradient(pink, white);
            background: -o-linear-gradient(pink, white);
        }

        #logo {
            position: absolute;
            top: -3px;
            left: -78px;
            height: 143px;
            width: 491px;
            text-decoration:none;
        }

        .hightlighted {
            text-decoration: none;
            font-size: large;
            font-weight: bold;
            color:#9453ae;
        }

        #tablamenu {
            width: 100%;
            margin: 0 auto;
        }

        .fila {
            width: 100%;
            margin: 0 auto;
        }

        .style {
            text-decoration: none;
            color: black;
            font-size: large;
        }

        .h {
            text-align: center;
            float: left;
            margin: 10px 0 10px 0;
            width: <?php echo "$sizemenu" ?>%;
        }

            a:hover {
                color:#9453ae;
            }

        #contenedor {
            background-color: white;
            min-height: 290px;
            position:relative;
           
               
        }

        #tablaenlaces{
            font-size: small;
            position:relative;
            z-index: 1;
        }

            #tablaenlaces tr td{
                padding:5px;
                padding-left:10px;
                padding-right: 10px;
                background-color:#fcfcaf;
                border-radius: 5px 5px 5px 5px;
            }

        #registrar{
            border-style: solid;
            border-width: 1px;
            font-size:small;
            width: 430px;
            padding:10px;
            position:relative;
            z-index: 1;
        }

        #update{
            font-size: small;   
            float:left;
            width: 250px;
            padding:10px; 
            border-style: solid;
            border-width: 2px;
            border-radius: 5px 5px 5px 5px;
            margin-top:-360px;
            position:relative;
            z-index: 1;
        }

        #registrar {
            border-radius: 5px 5px 5px 5px;
            border-width: 2px;
        }

        #control{                               
            margin: auto;
            border-top: solid;
            border-width:1px;
            padding:20px;
        }

        .hightlighted {
            text-decoration: none;
            font-size: x-large;
            font-weight: bold;
            color: #9453ae;
        }

        .login2 {
            float: right;
            margin-top: 10px;
            margin-bottom: 5px;
            width: 237px;
        }

        #logout {
            font-size:15px;
            position:relative;
            top: 73px;
            left: 228px;
        }

            #logout a {
                text-decoration:none;
                color:grey;
            }

            #logout a:hover {
                text-decoration:underline;
                color:grey;
            }

        #botones1 {
            height: 48px;
            width: 250px;
            background-color: white;
            font-weight: bold;
        }
        #botones1:hover{
            background-color: #ffcc33;
        }
        .botones2 {
            height: 48px;
            width: 100px;
            background-color: white;
            font-weight: bold;
        }
         .botones2:hover{
             background-color: #ffcc33;
        }
        #pie1 {
            /*background-color: #9453ae;*/
            margin-top: -70px;
            width: 100%;
            height: 70px;
            background: -webkit-linear-gradient(white, pink);
            background: -ms-linear-gradient(white, pink);
            background: -moz-linear-gradient(white, pink);
            background: -o-linear-gradient(white, pink);
            position:relative;
            z-index:0;
        }

        #pie2 {
            /*background-color: #ba88ce;*/
            
            width: 100%;
            height: 150px;
            text-align: center;
            font-size:medium;
            background: -webkit-linear-gradient(pink, orange);
            background: -ms-linear-gradient(pink, orange);
            background: -moz-linear-gradient(pink, orange);
            background: -o-linear-gradient(pink, orange);
            position:relative;
            z-index:0;
        }
        #cuerpo{
            height:290px;
        }
    </style>

</head>
   <?php     
$menu=$_GET['menu'];

//$array = explode ('/', $_SERVER[SCRIPT_NAME]);
//foreach ($array as $frag) {   
//    $file=$frag;    
//}
$user=$_SESSION['username'];
if ($user=='Profesor'){
$file="profesor.php";}
else{
$file="alumno.php";    
} 
    ?>
<body>
    <div id="cabecera">

        <div id="logo">
            <a href='<?php echo "$file" ?>'><img src="img/logo.png" /></a>
        </div>

        <?php
            if (isset($_SESSION['username'])) {
                echo '<div id="login" class="login2">';
                echo "<h2>{$_SESSION['username']}</h2>";
                echo '</div><div id="logout" class="login2"><a href="logout.php">Logout</a></div>';
            }else echo '<div id="login" class="login2"><h2>No estás logueado</h2></div><br/><br/><div id="logout" class="login2"><a href=\'index.php\'>Login</a></div>';
        ?>

    </div>

    <div id="menu">
        <table id="tablamenu" border="0">
            <tr>
                <td class="fila">
                    <?php for ($i=0; $i<$length; $i++){ ?>
                    <div class="h"><a <?php if ($menu == "$categorias[$i]") {echo 'class="hightlighted"';}else {echo 'class="style"';}?> href="<?php echo "$file"?>?menu=<?php echo "$categorias[$i]" ?>"><?php echo "$categorias[$i]" ?></a></div>
                    <?php } ?>
                </td>
            </tr>
        </table>
    </div>
   
 <?php
 if (!isset($_SESSION['username'])) {
    echo"<div id='cuerpo'></div> ";
    }
    ?>
